var Mock = require('mockjs')
var Random = Mock.Random;//随机生成

var express = require('express')
var router = express.Router()

var Ajax = function(urlName, dataObj) {
  router.use(urlName, (req, res) => {
    return res.json(Mock.mock({
      'message': 'sjdj',
      'status': 200,
      'body': dataObj
    }))
  })
}

var profileData = {
    'list|1-10':[{
    'id|+1':1,
    "title": "支付宝目标用户领红包",
    "subTitle|1": [
      "引导目标用户登录支付宝，点击【天天领红包】领取红包",
      "引导目标用户登录支付宝"
    ],
    'imgUrl':Random.image('5x5', '#f2f2f2','#666666','png','icon')
  }]
}
Ajax('/profile', profileData)

// 拉黑记录信息
var blackInfoData = {
  'items|10': [
    {
      'infoId|+1': 10,
      'createTime': '@date("yyyy-MM-dd HH:mm:ss")',
      'bussAuthNum': '@natural',
      'bussAuthNumBlack|0-1': 1,
      'principalCertNo': /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
      'principalCertNoBlack|0-1': 1, 
      'bankCardNo': '@natural',
      'bankCardNoBlack|0-1': 1,
      'alipayNumber': '@email',
      'alipayNumberBlack|0-1': 1,
      'username': /^1[3456789]\d{9}$/,
      'usernameBlack|0-1': 1,
      'updateTime': '@date("yyyy-MM-dd HH:mm:ss")'
    }
  ],
  'total|5-40': 5
}
Ajax('/blackInfo', blackInfoData)

// 瀑布商城数据列表
var pbStoreData = {
  "items|10": [
    {
      "productId": "@natural",
      "batchName|1": [
        "三彩2019冬季新款小个","【现货闪发】75%医用酒精喷雾消毒液75酒精乙醇消毒免洗手皮肤75%酒精杀菌喷剂 5瓶 100ml"
      ],
      "title|1":[
        "三彩2019冬季新款小个","75%医用酒精喷雾消毒液"
      ],
      "imgUrl": "http://file.cdn.openpubu.com/20200110/fe272ca4b497e51ad83299f6ce2833b7.jpg",
      "productPriceText": "20.00",
      "isUsed|1": [0, 1],
      "oneAgentName":"杭州小瀑科技有效公司",
      "twoAgentName":"瀑布圈子",
      "companyName":"我是商户商户",
      "departmentName":"哎呀门店",
      "sallerName":"@cname",
      "tkCreateTime": '@date("yyyy-MM-dd HH:mm:ss")',
      "tradeParentId":"@natural",
      "tkStatus|1": [12,13,14,3],
      "tkTotalRate|1":["0.1%","0.2%"],
      "pubSharePreFee|0-1.1-2":1,
      "pubShareFee|0-1.1-2":1,
      "tradeId":"@natural",
      "tkPaidTime":'@date("yyyy-MM-dd HH:mm:ss")',
      "tkEarningTime":'@date("yyyy-MM-dd HH:mm:ss")',
      "itemTitle":"@ctitle",
      "itemNum|1-50":1,
      "itemPrice|1-100.1-2":1,
      "payPrice|1-100.1-2":1,
      "totalCommissionFee|0-1.1-2":1,
      "subsidyFee|0-1.1-2":1,
      "alimamaShareFee|0-1.1-2":1,
      "itemImg":"https://img.alicdn.com/i3/2975892770/O1CN01pKrJJX1WKhfhvtcAJ_!!2975892770.jpg"//商品图片
    }
  ],
  "total": 14,
  "model": "IShJ1ay5X6r",
  "zkFinalPrice": "88.00",
  "smallImages":["//img.alicdn.com/bao/uploaded/i1/2977116562/O1CN01SC4JJU1yLRX5Na1Oi_!!2977116562.jpg","https://img.alicdn.com/i3/2975892770/O1CN01pKrJJX1WKhfhvtcAJ_!!2975892770.jpg"],
	"title":"sfsf",
	"volume":213,
	"couponAmount":"8.00",
	"couponStartTime":"2019-12-12",
	"couponEndTime":"2019-12-12",
	"couponClickUrl":"https://img.alicdn.com/i3/2975892770/O1CN01pKrJJX1WKhfhvtcAJ_!!2975892770.jpg",
	"pictUrl":"//img.alicdn.com/bao/uploaded/i1/2977116562/O1CN01SC4JJU1yLRX5Na1Oi_!!2977116562.jpg",
  "afterAmount":1,
  "results|10": [{
    "zkFinalPrice":"88.00",//现价
    "category|1":["1","2"],
		"pictUrl":"https://img.alicdn.com/i3/2975892770/O1CN01pKrJJX1WKhfhvtcAJ_!!2975892770.jpg",//图片
		"title|1":[
      "三彩2019冬季新款小个","【现货闪发】75%医用酒精喷雾消毒液75酒精乙醇消毒免洗手皮肤75%酒精杀菌喷剂 5瓶 100ml"
    ],//宝贝名称
		"volume":1213,//月销量
		"couponAmount":"10.00",//优惠券金额
		"afterAmount":1,//用券后金额
		"numIid":324332,//商品ID
		"couponClickUrl":"",//分享链接（带入到商品详情页面）
		"couponStartTime":"2019-12-12",//开始时间（带入到商品详情页面）
		"couponEndTime":"2019-12-12",//结束时间（带入到商品详情页面）
  }],
  "data": {
    "title": "三彩2019冬季新款小个子中长款牛油果绿羊毛呢子外套双面呢",
    "itemImg":"https://img.alicdn.com/i3/2975892770/O1CN01pKrJJX1WKhfhvtcAJ_!!2975892770.jpg",//必填
    "pictUrl":"http://www.baidu.com"//非必填 若为空 提示链接不足，请联系运营人员
  },
  "totalResults": 18
}
Ajax('/pbStore', pbStoreData)

// 权益中心
var orderData = {
  "items|10": [
    {
      "id|1-100": 1,
      "oneAgentName":"@ctitle",
      "twoAgentName":"@ctitle",
      "companyName": "@ctitle",
      "staffName": "@cname",
      "qyName|1": [
        "咪咕音乐白金会员半年包优惠权益（线下）",
        "咪咕音乐白金会员半年包优惠权益（线上）"
      ],
      "phoneNum": /^1[3456789]\d{9}$/,
      "createTime": '@date("yyyy-MM-dd HH:mm:ss")',
      "supplier|1":["中国移动", "中国联通","中国电信"],
      "startTime": '@date("yyyy-MM-dd HH:mm:ss")',
      "endTime": '@date("yyyy-MM-dd HH:mm:ss")',
      "status|0-1": 1
    }
  ],
  "switchList": [
    {
      "name": "咪咕音乐白金会员半年包优惠活动（线下）",
      "isOpen": 0
    },{
      "name": "咪咕音乐白金会员半年包优惠活动1（线下）",
      "isOpen": 1
    }, {
      "name": "咪咕音乐白金会员半年包优惠活动2（线下）",
      "isOpen": 0
    }
  ],
  "total": 30
}
Ajax('/qyOrderData', orderData)

var data = {
  "picture": "http://file.cdn.openpubu.com/20200110/fe272ca4b497e51ad83299f6ce2833b7.jpg",
}
Ajax('/picture', data)

var h5Data = {
  "items|3-6": [
    {
      "id|+1": 1,
      "name": "@ctitle",
      "phone": /^1[3456789]\d{9}$/,
      "imgUrl|1": ["https://img.alicdn.com/i3/2975892770/O1CN01pKrJJX1WKhfhvtcAJ_!!2975892770.jpg","https://img.alicdn.com/i4/2975892770/O1CN010SZlq51WKhfeDPBaq_!!2975892770.jpg",""],
      "orderNo": "@natural",
      "staffPhone": /^1[3456789]\d{9}$/,
      "isEffect|1": ["是","否"],
      "province": "@ctitle",
      "groupSeq": "@natural",
      "staffName": "@cname",
      "customPhone": /^1[3456789]\d{9}$/,
      "isHF|1": ["是","否"],
      "hfAmount": "2.22",
      "address": "@ctitle"
    }
  ]
}
Ajax('/h5Data', h5Data)

var ltActivityList = {
  "item|10": [{
    "activityId|+1": 1,
    "code|100-1000": 1,
    "activityName": "@ctitle(7)",
    "zfAmount|0-2.0-2": 1,
    "czAmount|10-100": 10,
    "ltName":"@ctitle(5)",
    "ltId":"@natural",
    "valueCouponList|0-4":[
      {
        "id| 500-700": 1,
        "name":"@ctitle(5)"
      }
    ],
    "rightsCouponList|0-4": [
      {
        "id| 500-700": 1,
        "name":"@ctitle(5)"
      }
    ],
    "isUsed|1": ["0", "1"]
  }
  ],
  total: 55
}
Ajax('/ltActivityList', ltActivityList)

// 联通订单列表
var ltOrderList = {
  "item|10": [
    {
      "orderId": "@natural",
      "payTime": '@date("yyyy-MM-dd HH:mm:ss")',
      "activityName":"@ctitle",
      "tmAccount": "@cname",
      "phone": /^1[3456789]\d{9}$/,
      "czStatus|1": ["0","1","2","3"],
      "csStatus|1": ["0","1","2","3","4"],
      "valueStatus|1": ["0","1","2"],
      "rightsStatus|1": ["0","1","2"],
      "smStatus|1": ["0","1","2","3","4"]
    }
  ]
}
Ajax('/ltOrderList', ltOrderList)

var ltEditOrder = {
  "activityName": "@ctitle",
  "activityCode": "1233232",
  "zfAmount": "11",
  "czAmount": 1,
  "productId": 1,
  "channel": ['1','2'],
  "valueCouponIds": "23,23",
  "rightsCouponIds": "78,78",
  "isUsed": 1,
  "activityType": 1,
  "rechargeChannel": 1,
  "isNeedCZ":1,
  "downstream|1": [4,6]
}
Ajax('/ltEditOrder', ltEditOrder)

var rechargeList = {
  "items|5": [
    {
      id: 1,
      name: "@ctitle"
    }
  ]
}
Ajax('/rechargeList', rechargeList)

// 订单详情
var ltOrderDetail = {
  "orderInfo": {
    "orderId":"@natural",//id
    "orderNo":"@natural",//订单编号
    "hfbOrderNo":"@natural",//话费宝订单号
    "tmOrderNo":"@natural",//天猫订单号
    "tmAccount":"@cname",//办理人
    "payTime":'@date("yyyy-MM-dd HH:mm:ss")',//办理付款时间
    "phone":/^1[3456789]\d{9}$/,//办理手机号
    "activityName":"@ctitle",//办理活动
    "code":"@natural",//活动ID
    "zfAmount":"10",//活动支付金额
    "realAccount":"9.98",//实际支付金额
    // "smStatus|1": ["0","1","2","3","4"],//办理状态 0办理中 1办理成功 2办理失败 3 办理完结 4 待办理
    "smStatus": "0",
    "notice": "按时",
    "downstream|1": [4,6]
  },
  "czInfo":{//充值信息
    "orderNo":"@natural",//充值订单号
    "amount":"100",//充值金额
    "time":'@date("yyyy-MM-dd HH:mm:ss")',//充值时间
    // "status|1":["0","1","2","3"],//充值状态 0充值中 1充值成功 2充值失败 3无法充值
    "status": "2",
    "failMsg":"尽快尽快尽快就收到货收到和是的是的所",//失败原因
    "id":"@natural"//充值订单id
  },
  "csInfo":{//存送信息
    "orderNo":"@natural",//存送订单号
    "name":"@ctitle",//存送产品名称
    "time":'@date("yyyy-MM-dd HH:mm:ss")',//存送时间
    // "status|1":["0","1","2","4"],//存送状态 0办理中 1办理成功 2办理失败 4 预下单成功
    "status": "4",
    "failMsg":"借记卡京津冀发货卡喝咖啡哈哈发货客家话",//失败原因
    "id":"@natural"//存送订单id
  },
  "valueInfo|0-4":[
    {//有价券信息
    "orderNo":"@natural",//订单号
    "name":"@ctitle",//有价券名称
    "time":'@date("yyyy-MM-dd HH:mm:ss")',//发放时间
    "status|1": ["0","1"],//发放状态 0发放失败 1发放成功 
    "failMsg":"疑人勿用日安徽的苦哈哈多看看",//失败原因
    "id":"@natural"//有价券订单id
    }
  ],
  "rightsInfo|0-4":[
    {//权益信息
    "orderNo":"@natural",//订单号
    "name":"@ctitle",//权益名称
    "time":'@date("yyyy-MM-dd HH:mm:ss")',//发放时间
    "status|1": ["0","1"],//发放状态 0发放失败 1发放成功 
    "failMsg":"说的发慷慨大方世纪东方开始看付款后",//失败原因
    "id":"@natural"//权益订单id
    }
  ]
}
Ajax('/ltOrderDetail', ltOrderDetail)

var dyData = {
  "items|10": [
    {
      "id|1-100": 1,
      "dataTime": '@date("yyyy-MM-dd")',
      "oneAgentName":"@ctitle",
      "twoAgentName":"@ctitle",
      "companyName": "@ctitle",
      "shopName": "@ctitle",
      "staffName": "@cname",
      "jhNum|0-100": 1,
      "ygAmount|0-100": 1,
      "realAmount|0-100": 1,
      "rate": "100%"
    }
  ],
  "total": {
    "jhNum": 10,
    "ygAmount": 10,
    "realAmount": 10
  },
  "totalSize": 22
}
Ajax('/dyData', dyData)

var editProduct = {
  "items|10": [{
    "id": "@natural",
    "orderId":"@natural",//id
    "orderNo":"@natural",//订单编号
    "hfbOrderNo":"@natural",//话费宝订单号
    "tmOrderNo":"@natural",//天猫订单号
    "tmAccount":"@cname",//办理人
    "payTime":'@date("yyyy-MM-dd HH:mm:ss")',//办理付款时间
    "phone":/^1[3456789]\d{9}$/,//办理手机号
    "activityName":"@ctitle",//办理活动
    "code":"@natural",//活动ID
    "zfAmount":"10",//活动支付金额
    "realAccount":"9.98",//实际支付金额
    "smStatus|1": ["0","1","2"]//办理状态 0办理中 1办理成功 2办理失败
  }],
  "goodsInfo": {
    "operator":'5',
    "proCode":'1',
    "proName":'as',
    "proIcon":'1',
    "proIntroduce":'1',
    "proIntro":'1',
    "proSource":'5', // 变更为上游渠道
    "proType":'1',
    "monthRent":'1', // 月租
    "webHeadStr":'1',
    "pureNewScore":'1',
    "noPureNewScore":'1',
    "proAttr": '1', // 商品属性
    "isRelName": '1',
    "areaOperator": '1' // 地区运营商
  }
}
Ajax('/editProduct', editProduct)

var unicomSwitch = {
  "items": [
    {
      "type": 1,
      "name": "订购业务",
      "isOpen|1": [0, 1]
    }, {
      "type": 2,
      "name": "存送业务",
      "isOpen|1": [0, 1]
    }
  ]
}
Ajax('/unicomSwitch', unicomSwitch)

var refundData = {
  "items|10": [
    {
      "id": "@natural",
      "orderId": "@natural",
      "date": '@date("yyyy-MM-dd")',
      "company": "@ctitle",
      "phone": /^1[3456789]\d{9}$/,
      "expectSKAmount": "12.0",
      "expectHKAmount": "12.0",
      "restPeriod": "10",
      "realSKAmount": "22.0",
      "realHKAmount": "22.0",
      "status|1": [1,2,3,4], // 1 待审核 2 审核拒绝 3 提前还款中 4 已完成
      "wsStatus|1": [1,2,3], // 1 交易中 2 交易成功 3 交易失败
      "imgUrl": Random.image('216x216', '#f2f2f2','#666666','png','icon'),
      "jdStatus": '' //解冻转支付 1 交易中心 2 交易成功 3 交易失败
    }
  ],
  "totalSize": 25,
  "codeUrl": "http://www.baidu.com",
  "isSuccess|1": ['1', '']
}
Ajax('/refundData', refundData)

// 供应商
var supplierList = {
  "items|5": [{
    "supplierId|+1" : 1,
    "supplierName": "@ctitle"
  }]
}
Ajax('/supplierList', supplierList)
// 父商品
var parentList = {
  "items|5": [{
    "productId|+1" : 1,
    "name": "@ctitle"
  }]
}
Ajax('/parentList', parentList)
// 商品库列表
var empty = {
  "items": []
}
Ajax('/empty', empty)
// 商品库列表
var productList = {
  "items|10": [{
    "product": "@natural",
    "productId": "@natural",
    "xpCode":"@natural",
    "name":"@ctitle",
    "productType|1": [1, 2], //商品类型 1号卡业务 2套餐业务
    "productTypeText":"商品类型",
    "operator|1": [8, 9, 10], //运营商 8电信 9联通 10移动
    "operatorText":"运营商",
    "supplierId": "@natural", //供货商ID
    "supplierText":"供应商",
    "code":"@natural",
    "parentId": "@natural", //父商品ID
    "parentXpCode":"@natural",
    "parentName":"@ctitle",
    "isPopularizeText|1":["是", "否"],
    "promotionMethods|1": [1,2,3],
    "position": 1,
    "isUsed|1": [1, 0]
  }]
}
Ajax('/productList', productList)
// 政策
var policy = {
  "items|10": [{
    "productPolicyId|+1": 1, //商品运营政策ID 
    "productId|+1": 1, //商品ID
    "supplier|+1":1, //供应商ID
    "supplierName":"@ctitle",
    "name": "@ctitle",
    "policyContent":"@ctitle",
    "objectOriented":"@ctitle",
    "isUsed|1":[1, 0], //1上线 0下线
    "isUsedText":"上线",
    "effectTime":'@date("yyyy-MM-dd")'
  }],
  "policy": {
    "policyContent|1": ["政策内容1", "政策内容2"],
    "objectOriented|1": ["面向对象1","面向对象2"],
    "isUsedText|1": ["上线", "下线"],
    "effectTime": '@date("yyyy-MM-dd")'
  }
}
Ajax('/policy', policy)

// 供应商选择商品
var supplierProduct = {
  "items|5": [{
    "productId|+1":1, //商品ID
    "name":"@ctitle"
  }]
}
Ajax('/supplierProduct', supplierProduct)

// 推广商品修改
var productEdit = {
  "supplier|+1": 1,
  "supplierName": "@ctitle",
  "productId|+1": 1,
  "productName": "@ctitle",
  "promotionMethods|1": [1,2,3],
  "promotionUrl": "@ctitle",
  "position": "1",
  "isRealName|+1": [1,0],
  "isQrCode|+1": [0,1],
  "abstracts": "@ctitle",
  "imgUrl": "http://file.cdn.openpubu.com/20191125/429a4df28fc3440918601daaaf4ad90e.png",
  "contentUrl": "http://file.cdn.openpubu.com/20191125/429a4df28fc3440918601daaaf4ad90e.png",
  "settleMethod": "1,2,3"
}
Ajax('/productEdit', productEdit)

var areaList = {
  "items": [{
    "id": "1",
    "name": "全国",
    "isUsed": 1
  }, {
    "id": "2",
    "name": "浙江",
    "isUsed": 1,
    "cityList": [{
      "id": "21",
      "name": "杭州",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }, {
      "id": "22",
      "name": "金华",
      "isUsed": 1
    }]
  }, {
    "id": "3",
    "name": "河南",
    "isUsed": 1,
    "cityList": [{
      "id": "31",
      "name": "郑州",
      "isUsed": 1
    }]
  }]
}
Ajax('/areaList', areaList)
module.exports = router;


// 3：订单结算，12：订单付款， 13：订单失效，14：订单成功
